import lxml.etree as le

with open("index.html","r",encoding="utf-8") as f:
    # 读取网页信息
    Html=f.read()
    # 转化为Xpath对象
    Html_x=le.HTML(Html)
    # 读取分类标签
    Category_x_s=Html_x.xpath("//div[@class='classify_cList']")
    result=[]
    for Category_x in Category_x_s:
        category_first=Category_x.xpath("./h3/a/text()")[0]
        category_second=Category_x.xpath("./div/span/a/text()")
        # 添加到结果集
        result.append(
            dict(
                category_first=category_first,
                category_second=category_second
            )
        )

    # 打印结果集、
    for item in result:
        print(item.get("category_first"))
        for category in item.get("category_second"):
            print('     ',category)